package com.sys.basics.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.*;

/**
 * @author: ares
 * @date: 2021-10-08
 * @description: 行政区域表 实体
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_area")
@ApiModel(value = "SysArea对象", description = "行政区域表")
public class SysArea implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "区域id")
    @TableId(value = "area_id", type = IdType.AUTO)
    private Long areaId;

    @ApiModelProperty(value = "行政区划代码")
    @TableField("area_code")
    private String areaCode;

    @ApiModelProperty(value = "父级id")
    @TableField("parent_code")
    private String parentCode;

    @ApiModelProperty(value = "地区名称")
    @TableField("name")
    private String name;

    @ApiModelProperty(value = "层级")
    @TableField("layer")
    private Integer layer;

    @ApiModelProperty(value = "排序号,1:省级,2:地市,3:区县")
    @TableField("order_num")
    private Integer orderNum;

    @ApiModelProperty(value = "显示,1:显示,0:隐藏")
    @TableField("status")
    private Integer status;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "乐观锁(版本号)")
    @TableField("version")
    @Version
    private Integer version;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime gmtModified;

    @ApiModelProperty(value = "创建者id")
    @TableField(value = "creator_id", fill = FieldFill.INSERT)
    private Long creatorId;

    @ApiModelProperty(value = "修改者id")
    @TableField(value = "modifier_id", fill = FieldFill.INSERT_UPDATE)
    private Long modifierId;

    @ApiModelProperty(hidden = true)
    @TableField(exist = false) // mybatis plus 注解,. 表明此字段在数据库中不存在
    private List<SysArea> children;
}
